package com.lianzhihui.romeex.ui.trade;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.cardview.widget.CardView;

import com.lianzhihui.romeex.R;
import com.lianzhihui.romeex.bean.ConversionConvetListBean;
import com.lianzhihui.romeex.config.AppConstants;
import com.lianzhihui.romeex.ui.base.BaseActivity;

import java.text.MessageFormat;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * @ProjectName: romeex
 * @Package: com.lianzhihui.romeex.ui.trade
 * @ClassName: ExchangeDetailActivity
 * @Description: 兑换详情
 * @Author: zhanghong
 * @CreateDate: 2020/11/23 16:20
 * @UpdateUser: 更新者：
 * @UpdateDate: 2020/11/23 16:20
 * @UpdateRemark: 更新说明：
 * @Version: 1.0
 */
public class ExchangeDetailActivity extends BaseActivity {


    @BindView(R.id.include_top_iv_back)
    ImageView includeTopIvBack;
    @BindView(R.id.include_top_lin_newback)
    LinearLayout includeTopLinNewback;
    @BindView(R.id.include_top_tv_title)
    TextView includeTopTvTitle;
    @BindView(R.id.include_top_iv_right_second)
    ImageView includeTopIvRightSecond;
    @BindView(R.id.include_top_tv_right)
    TextView includeTopTvRight;
    @BindView(R.id.include_top_lin_right)
    LinearLayout includeTopLinRight;
    @BindView(R.id.include_top_lin_background)
    LinearLayout includeTopLinBackground;
    @BindView(R.id.app_top_bar)
    LinearLayout appTopBar;
    @BindView(R.id.iv_icon)
    ImageView ivIcon;
    @BindView(R.id.tv_state)
    TextView tvState;
    @BindView(R.id.tv_success_time)
    TextView tvSuccessTime;
    @BindView(R.id.tv_type)
    TextView tvType;
    @BindView(R.id.countType)
    TextView countType;
    @BindView(R.id.rl_type_range)
    RelativeLayout rlTypeRange;
    @BindView(R.id.tv_fee)
    TextView tvFee;
    @BindView(R.id.rl_fee_range)
    RelativeLayout rlFeeRange;
    @BindView(R.id.tv_pr)
    TextView tvPr;
    @BindView(R.id.tv_receive_address)
    TextView tvReceiveAddress;
    @BindView(R.id.tv_address_to)
    TextView tvAddressTo;
    @BindView(R.id.tv_payment_address)
    TextView tvPaymentAddress;
    @BindView(R.id.tv_address_from)
    TextView tvAddressFrom;
    @BindView(R.id.tv_id_number)
    TextView tvIdNumber;
    @BindView(R.id.tv_hash_id)
    TextView tvHashId;
    @BindView(R.id.tv_remark)
    TextView tvRemark;
    @BindView(R.id.qu_kuai)
    TextView quKuai;
    @BindView(R.id.cardview)
    CardView cardview;
    private ConversionConvetListBean.ContentBean bean;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_exchange_details;
    }

    @Override
    protected void initView() {
        Bundle extras = getIntent().getExtras();
        if (extras != null) {
            bean = (ConversionConvetListBean.ContentBean) extras.get(AppConstants.INTENT_EXCHANGE_DETAILS);
        }
        setTitle(getString(R.string.text_exchange_details));
    }


    @Override
    protected void whiteStauebar() {
        super.whiteStauebar();

    }

    @OnClick({R.id.tv_address_from, R.id.tv_hash_id, R.id.tv_remark})
    public void onclick(View v) {
        switch (v.getId()) {
            case R.id.tv_address_from:
                copyString(tvAddressFrom.getText().toString().trim());
                break;
            case R.id.tv_hash_id:
                copyString(tvHashId.getText().toString().trim());
                break;
            case R.id.tv_remark:
                copyString(tvRemark.getText().toString().trim());
                break;
            default:
                break;
        }
    }

    @Override
    protected void initData() {
        if (null != bean) {
            countType.setText(MessageFormat.format("{0}{1}", bean.getPayBalance(), bean.getSourceCoinName()));
            tvFee.setText(MessageFormat.format("{0}{1}", bean.getTargetBalance(), bean.getTargetCoinName()));
            tvPr.setText(MessageFormat.format("1{0}={1}{2}", bean.getSourceCoinName(), bean.getRate(), bean.getTargetCoinName()));
            tvAddressTo.setText(MessageFormat.format("{0}{1}", bean.getFee(), bean.getTargetCoinName()));
            tvAddressFrom.setText(bean.getTargetAddress());
            tvHashId.setText(bean.getWalletAddress());
            tvRemark.setText(bean.getHash());

        }
    }


}
